package com.janko.springbootbase.designmode.multitonPattern;

public class mainTest {
    public static void main(String[] args) {
        sqlConnectionTest();
        emperorTest();
    }

    private static void sqlConnectionTest() {
        for (int i = 0; i < 10; i++) {
            SQLConnectionPools sqlConnectionPools= SQLConnectionPools.getInstance();
            System.out.println("用户"+i+"获得的线程是："+sqlConnectionPools.hashCode());
        }
    }

    private static void emperorTest() {
        Emperor mEmperor = Emperor.getInstance(0);
        System.out.println(mEmperor.hashCode());
        mEmperor = Emperor.getInstance(1);
        System.out.println(mEmperor.hashCode());
        mEmperor = Emperor.getInstance(2);
    }

}
